<template>
  <div>
    <input type="text" ref="inp" v-if="flag" placeholder="请输入要搜索的内容"> 
    <button @click="change" v-else>点我搜索</button>
  </div>
</template>

<script>


export default {
  

data(){
  return{
    flag:false
  }
},
methods:{
 change(){
   this.flag = true
  this.$nextTick(()=>{
    this.$refs.inp.focus()
  })
 }
  
}
}
</script>

<style>

</style>